x=2*216**8 +4*36**12 + 6**15 - 1296
s=' '
while x!=0:
    s+=str(x%16)
    x//=16
s=s[::-1]
print(s.count('0'))

